import { $Http } from '@/config/service/http';

export enum Api {
  // 个人文件目录
  directoryBatchDelete = '/dmsfile/personFileDirectory/batchDelete', // 批量删除
  // directoryBatchDownload = '/dmsfile/personFileDirectory/createBatchDownloadTask', // 批量下载
  directoryBatchDownload = '/dmsfile/personFileDirectory/batchDownload', // 批量下载
  directoryCopyFile = '/dmsfile/personFileDirectory/copyFile', // 复制文件
  directoryDelete = '/dmsfile/personFileDirectory/delete', // 删除
  // directoryDownload = '/dmsfile/personFileInfo/downloadPartFile', // 单个下载
  directoryDownload = '/dmsfile/personFileDirectory/download', // 单个下载
  directoryGet = '/dmsfile/personFileDirectory/get', // 详情
  directoryGetChildFolderFiles = '/dmsfile/personFileDirectory/getChildFolderFiles', // 得到文件夹下的目录和文件列表
  directoryGetChildrenFolders = '/dmsfile/personFileDirectory/getChildrenFolders', // 获取子文件夹列表
  directoryGetParentFolder = '/dmsfile/personFileDirectory/getParentFolder', // 得到指定父层级的文件夹
  directoryMoveFile = '/dmsfile/personFileDirectory/moveFile', // 移动文件
  directoryPage = '/dmsfile/personFileDirectory/page', // 分页查询
  directoryQueryFolderWithFilePage = '/dmsfile/personFileDirectory/queryFolderWithFilePage', // 文件夹和文件分页查询
  directoryQueryParentFolderFilePage = '/dmsfile/personFileDirectory/queryParentFolderFilePage', // 得到父亲文件夹下的目录和文件列表分页查询
  directoryRename = '/dmsfile/personFileDirectory/rename', // 重命名
  directorySave = '/dmsfile/personFileDirectory/save', // 保存
  // 个人文件详情
  fileCopyFile = '/dmsfile/personFileInfo/copyFile', // 复制文件
  fileDelete = '/dmsfile/personFileInfo/delete', // 删除
  fileGet = '/dmsfile/personFileInfo/get', // 详情
  fileGetOnlineEditConfig = '/dmsfile/personFileInfo/getOnlineEditConfig', // 得到在线编辑的配置信息
  fileGetPreviewFileToken = '/dmsfile/personFileInfo/getPreviewFileToken', // 获取文件预览令牌
  fileGetPreviewFileUrl = '/dmsfile/personFileInfo/getPreviewFileUrl', // 获取文件预览地址
  fileGetUploadFileToken = '/dmsfile/personFileInfo/getUploadFileToken', // 获取文件上传令牌
  fileGetVisitFileToken = '/dmsfile/personFileInfo/getVisitFileToken', // 获取文件访问令牌
  fileMoveFile = '/dmsfile/personFileInfo/moveFile', // 移动文件
  filePage = '/dmsfile/personFileInfo/page', // 分页查询
  fileRename = '/dmsfile/personFileInfo/rename', // 重命名
  fileSave = '/dmsfile/personFileInfo/save', // 保存
  fileUploadFile = '/dmsfile/personFileInfo/uploadFile', // 上传文件
  fileUploadFiles = '/dmsfile/personFileInfo/uploadFiles', // 上传多个文件
  fileViewFile = '/dmsfile/personFileInfo/viewFile', // 查看文件
  // 个人文件版本
  versionDelete = '/dmsfile/personFileVersion/delete', // 删除
  versionDownload = '/dmsfile/personFileVersion/download', // 查看或下载文件
  versionGet = '/dmsfile/personFileVersion/get', // 详情
  versionGetByFileId = '/dmsfile/personFileVersion/getByFileId', // 得到文件版本列表
  versionGetPreviewFileUrl = '/dmsfile/personFileVersion/getPreviewFileUrl', // 获取文件预览地址
  versionGetPublicVisitFileUrl = '/dmsfile/personFileVersion/getPublicVisitFileUrl', // 获取文件公共访问地址
  versionPage = '/dmsfile/personFileVersion/page', // 分页查询
  versionSave = '/dmsfile/personFileVersion/save', // 保存
  versionSetAsCurrent = '/dmsfile/personFileVersion/setAsCurrent', // 设置当前版本为最新版本
  versionViewFile = '/dmsfile/personFileVersion/viewFile', // 查看文件
  // 个人文件任务记录
  recordDelete = '/dmsfile/personFileTaskRecord/delete', // 删除
  recordGet = '/dmsfile/personFileTaskRecord/get', // 详情
  recordPage = '/dmsfile/personFileTaskRecord/page', // 分页查询
  recordSave = '/dmsfile/personFileTaskRecord/save' // 保存
}

export const directoryBatchDelete = (params) => {
  return $Http.api(Api.directoryBatchDelete, params, 'post');
};

export const directoryGet = (id) => {
  return $Http.api(Api.directoryGet, id, 'get');
};

export const fileUploadFile = (id) => {
  return $Http.api(Api.fileUploadFile, id, 'post');
};

export const directoryGetChildrenFolders = (params) => {
  return $Http.api(Api.directoryGetChildrenFolders, params, 'post');
};

export const directorySave = (params) => {
  return $Http.api(Api.directorySave, params, 'post');
};

export const fileGetPreviewFileUrl = (params) => {
  return $Http.api(Api.fileGetPreviewFileUrl, params, 'post');
};

export const setAsCurrent = (params) => {
  return $Http.api(Api.versionSetAsCurrent, params, 'post');
};

export const directoryQueryFolderWithFilePage = (params) => {
  return $Http.api(Api.directoryQueryFolderWithFilePage, params, 'post');
};
